<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <link rel="stylesheet" type="text/css" href="__STATIC__/index/css/style.css"/>
    <script type="text/javascript" src="__STATIC__/index/js/rem.js"></script>
    <title>订单详情</title>
</head>
<body class="geryBg">
<div class="order">
    <!--订单状态-->
    <div class="order_status clear">
        <div class="fl white status_text">
            <p class="wait_send">
                {if $order.shouhou_status==3}已退款
                {elseif $order.shouhou_status==4}等待商家审核
                {elseif $order.shouhou_status==5}等待买家寄回
                {elseif $order.shouhou_status==6}待商家收货
                {elseif $order.shouhou_status==7}售后未通过
                {elseif $order.shouhou_status==8}商家已退款
                {elseif $order.shouhou_status==10}买家已撤销
                {/if}
            </p>
        </div>
        <div class="fr status_icon">
            <img class="auto-img" src="__STATIC__/index/img/icon-order-status_5.png"/>
        </div>
    </div>
    <!--收货人地址-->
    <div class="order_address">
        <div class="order_add_detail">
            <div class="clear order_concat smoth">
                <p class="fl">收货人: <em>{$order.name}</em></p>
                <p class="fr">{$order.phone}</p>
            </div>
            <div class="order_add smoth">
                <img class="icon-add" src="__STATIC__/index/img/icon-add.png"/>
                <p>收货地址：{$order.address}</p>
            </div>
        </div>
        <p class="line"></p>
    </div>
    <!--商品详情-->
    {foreach $order.orderlist as $vo}
    <div class="order_goods whiteBg clear">
        <div class="order_img fl">
            <img class="auto-img" src="{$vo.goods_spec_img}"/>
        </div>
        <div class="order_des fr">
            <div class="clear super-text smoth bold">
                <p class="fl">{$vo.goods_title}</p>
                <p class="fr">￥{$vo.price}</p>
            </div>
            <div class="clear normall-text lightgery">
                <p class="fl">{$vo.goods_spec}</p>
                <p class="fr">X {$vo.num}</p>
            </div>
            <div class="clear normall-text lightgery">
                <p class="fr">实付：{$vo.pay}</p>
            </div>
            {if $vo.status==6}
            <div class="clear normall-text lightgery">
                <p class="fr">退款时间：{$vo.payment_time}</p>
            </div>
            {/if}
        </div>
        <div class="order_btn clear" style="position: static">
            <div class="fr normall-text">
                {if $order.shouhou_status!=3}
                {if $vo.status==1 && $vo.is_com==0}
                {if $vo.is_jiesuan==0}
                <button class="cancel" data-value="{$vo.id}">申请售后</button>
                {/if}
                <button class="pay_now" data-value="{$vo.id}">立即评价</button>
                {/if}

                {if $vo.status==2}
                <button class="cancel" style="width: 2rem" disabled>正在申请售后</button>
                <button class="cancel" data-value="{$vo.id}">撤销申请</button>
                {/if}

                {if $vo.status==7}
                <button class="cancel" disabled>已撤销</button>
                {if $vo.is_com==0}
                <button class="pay_now" data-value="{$vo.id}">立即评价</button>
                {/if}
                {/if}

                {if $vo.status==3}
                <button class="cancel" data-value="{$vo.id}">撤销申请</button>
                <button class="pay_now" data-value="{$vo.id}">寄回去</button>
                {/if}

                {if $vo.status==4}
                <!--<button class="cancel" data-value="{$vo.id}">撤销申请</button>-->
                <button class="pay_now">联系客服</button>
                {/if}

                {if $vo.status==5}
                <button class="cancel" style="width: 2rem" disabled>申请未通过</button>
                <button class="pay_now">联系客服</button>
                    {if $vo.is_com==0}
                    <button class="pay_now" data-value="{$vo.id}">立即评价</button>
                    {/if}
                {/if}

                {if $vo.status==6}
                <button class="cancel" disabled>已退货</button>
                {/if}

                {/if}
            </div>
        </div>
    </div>
    {/foreach}

    <!--运费-->
    <div class="order_carriage whiteBg">
        <div class="clear normall-text smoth">
            <p class="fl">积分</p>
            <p class="fr">-￥{$order.point_pay}</p>
        </div>
        <div class="clear super-text smoth bold">
            <p class="fl">实付款</p>
            <p class="fr brown">￥{$order.pay}</p>
        </div>
    </div>
    <!--订单支付方式-->
    <div class="order_pay smoth normall-text whiteBg">
        <p>订单编号: <em>{$order.order_num}</em></p>
        <p>支付方式: <em>微信</em></p>
        <p>下单时间: <em>{$order.create_at}</em></p>
        {if $order.shouhou_status==3}
        <p>退款时间: <em>{$order.refund_time}</em></p>
        {/if}
    </div>
    <!--订单支付按钮-->

</div>
<div class="cart_pop">
    <div class="pop_msg">
        <img class="pop_close" src="__STATIC__/index/img/icon-close.png" onclick="hideTips('.cart_pop')"/>
        <p class="text-center super-text smoth bold"></p>
        <div class="pop_btn">
            <button class="cancel" onclick="hideTips('.cart_pop')">取消</button>
            <button class="ensure">确定</button>
        </div>
    </div>
</div>
<script type="text/javascript" src="__STATIC__/index/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="__STATIC__/index/js/layer/mobile/layer.js"></script>

<script type="text/javascript">
    //弹出框
    function showTips(classname) {
        return $(classname).show()
    }

    function hideTips(classname) {
        return $(classname).hide()
    }

    //点击操作按钮
    $('.order_btn button').on('click', function () {
        var id = $(this).data('value');
        if ($(this).text() == '申请售后') {
            //点击申请售后
            window.location.href = 'post_sale?id='+$(this).data('value');
        } else if ($(this).text() == '立即评价') {
            //点击立即评价
            window.location.href = 'comment?id='+$(this).data('value');
        }else if ($(this).text() == '撤销申请') {
            //点击撤销申请
            showTips('.cart_pop');
            $('.cart_pop .pop_msg p').html('是否确认撤销?');
            $('.ensure').on('click', function (){
                hideTips('.cart_pop');

                $.ajax({
                    url:"cancel_five",
                    type:"post",
                    data:{id:id},
                    success:function (res) {
                        if(res.code=='ok'){
                            layer.open({
                                content: res.msg,
                                skin: 'msg',
                                time: 2,
                                end: function () {
                                    window.location.reload();
                                }
                            })
                        }
                    }
                })
            })
            // window.location.href = 'comment?id='+$(this).data('value');
        }else if ($(this).text() == '寄回去'){
            window.location.href = 'jihui?id='+$(this).data('value');
        }
    })
</script>
</body>
</html>